#include "interface.h"

GtkWidget*
create_windowMessage (char *Message)
{
	GtkWidget *windowMessage;
	GtkWidget *vboxPopup;
	GtkWidget *hboxInfo;
	GtkWidget *vboxInfo;
	GtkWidget *imageInfo;
	GtkWidget *labelMessage;
	GtkWidget *hbuttonboxOK;
	GtkWidget *buttonOK;
	GtkTooltips *tooltips;

	tooltips = gtk_tooltips_new ();

	windowMessage = gtk_window_new (GTK_WINDOW_POPUP);
	gtk_tooltips_set_tip (tooltips, windowMessage, _("w3live Information"), NULL);
	gtk_window_set_title (GTK_WINDOW (windowMessage), _("w3live - Information"));
	gtk_window_set_position (GTK_WINDOW (windowMessage), GTK_WIN_POS_MOUSE);
	gtk_window_set_resizable (GTK_WINDOW (windowMessage), FALSE);
	gtk_window_set_destroy_with_parent (GTK_WINDOW (windowMessage), TRUE);

	vboxPopup = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vboxPopup);
	gtk_container_add (GTK_CONTAINER (windowMessage), vboxPopup);

	hboxInfo = gtk_hbox_new (FALSE, 5);
	gtk_widget_show (hboxInfo);
	gtk_box_pack_start (GTK_BOX (vboxPopup), hboxInfo, FALSE, FALSE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (hboxInfo), 10);

	vboxInfo = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vboxInfo);
	gtk_box_pack_start (GTK_BOX (hboxInfo), vboxInfo, FALSE, FALSE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (vboxInfo), 5);

	imageInfo = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_DIALOG);
	gtk_widget_show (imageInfo);
	gtk_box_pack_start (GTK_BOX (vboxInfo), imageInfo, FALSE, FALSE, 0);

	labelMessage = gtk_label_new (_("You may specify a script to be run when a monitor is triggered.\n\nScripts will be instantiated as follows:\n\n> <i>script</i> \"timestamp\" \"monitor name\" \"message\""));
	gtk_widget_show (labelMessage);
	gtk_box_pack_start (GTK_BOX (hboxInfo), labelMessage, TRUE, TRUE, 0);
	gtk_widget_set_usize (labelMessage, 350, -2);
	gtk_label_set_use_markup (GTK_LABEL (labelMessage), TRUE);
	gtk_label_set_justify (GTK_LABEL (labelMessage), GTK_JUSTIFY_LEFT);
	gtk_label_set_line_wrap (GTK_LABEL (labelMessage), TRUE);
	gtk_misc_set_padding (GTK_MISC (labelMessage), 5, 5);

	hbuttonboxOK = gtk_hbutton_box_new ();
	gtk_widget_show (hbuttonboxOK);
	gtk_box_pack_start (GTK_BOX (vboxPopup), hbuttonboxOK, FALSE, FALSE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (hbuttonboxOK), 5);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonboxOK), GTK_BUTTONBOX_END);
	gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonboxOK), 5);

	buttonOK = gtk_button_new_from_stock ("gtk-ok");
	gtk_widget_show (buttonOK);
	gtk_container_add (GTK_CONTAINER (hbuttonboxOK), buttonOK);
	GTK_WIDGET_SET_FLAGS (buttonOK, GTK_CAN_DEFAULT);

	gtk_signal_connect_object (GTK_OBJECT (buttonOK), "clicked",
                        	  GTK_SIGNAL_FUNC (gtk_widget_destroy),
                        	  GTK_OBJECT (windowMessage));

	/* Store pointers to all widgets, for use by lookup_widget(). */
	GLADE_HOOKUP_OBJECT_NO_REF (windowMessage, windowMessage, "windowMessage");
	GLADE_HOOKUP_OBJECT (windowMessage, vboxPopup, "vboxPopup");
	GLADE_HOOKUP_OBJECT (windowMessage, hboxInfo, "hboxInfo");
	GLADE_HOOKUP_OBJECT (windowMessage, vboxInfo, "vboxInfo");
	GLADE_HOOKUP_OBJECT (windowMessage, imageInfo, "imageInfo");
	GLADE_HOOKUP_OBJECT (windowMessage, labelMessage, "labelMessage");
	GLADE_HOOKUP_OBJECT (windowMessage, hbuttonboxOK, "hbuttonboxOK");
	GLADE_HOOKUP_OBJECT (windowMessage, buttonOK, "buttonOK");
	GLADE_HOOKUP_OBJECT_NO_REF (windowMessage, tooltips, "tooltips");

	return windowMessage;
}
